package com.caregiver.watch.business.care.model.vo;

import com.caregiver.watch.common.utils.time.DateUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @description: 心率详情
 * @program: caregiver-watch
 * @author: 疆戟
 * @create: 2025-10-02 09:58
 */
@Data
@Schema(description = "心率详情")
public class HeartRateDetailVo {

    @Schema(description = "平均心率")
    private Integer avgHeartRate;

    @Schema(description = "最高心率")
    private Integer maxHeartRate;

    @Schema(description = "最低心率")
    private Integer minHeartRate;

    @Schema(description = "心率数据")
    private List<HeartRateData> heartRateData;

    @Data
    @Schema(description = "心率数据")
    public static class HeartRateData {

        @Schema(description = "时间(单位分钟)")
        private Integer time;
        @Schema(description = "心率")
        private Integer heartRate;

        public static HeartRateData build(LocalDateTime time, Integer heartRate) {
            HeartRateData heartRateData = new HeartRateData();
            heartRateData.time = DateUtils.getMinute(time);
            heartRateData.heartRate = heartRate;
            return heartRateData;
        }
    }
}
